﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using LGCourt.Logic.BLL;
using LGCourt.Logic.NBL.DBEntities;
using KMFrame.Permission.Util;
using LGCourt.Logic.Common;

namespace lgweb
{
    public partial class login : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            this.Session.Clear();
            this.txtUserName.Value = Request.Cookies["CooikeUserName"] == null ? "" : Server.UrlDecode(Request.Cookies["CooikeUserName"].Value.ToString());
            OA oaBLL = new OA();
            vOAORGInfo orgInfo = oaBLL.GetOrgInfo();
            this.h_rtxinstalled.Value = orgInfo.rtx.GetValueOrDefault(0).ToString();
            this.h_rtxserverip.Value = orgInfo.rtx_app_serverip;
            this.h_rtxserverport.Value = orgInfo.rtx_app_serverport.GetValueOrDefault(8000).ToString();
            this.hdOADomain.Value = System.Configuration.ConfigurationManager.AppSettings["OADomain"];
            if (h_rtxinstalled.Value == "") h_rtxinstalled.Value = "0";
            if (h_rtxserverip.Value == "") h_rtxserverip.Value = this.Request.Url.Authority;
            if (h_rtxserverport.Value == "") h_rtxserverport.Value = "8000";

            if (Request.QueryString["backpathurl"] != null && !string.IsNullOrEmpty(Request.QueryString["backpathurl"].ToString()))
            {
                this.hdnUrl.Value = Request.QueryString["backpathurl"].ToString();
            }

            if (Request.Cookies["userpwd"] != null && !string.IsNullOrEmpty(Request.Cookies["userpwd"].Value.ToString()))
            {
                this.chxup.Checked = true;
                this.TempPassword.Value = Request.Cookies["pd"] == null ? "" : Request.Cookies["pd"].Value.ToString(); 
            }
            
        }
    }
}